//
//  WebExtractSet.h
//  WebClipper
//
//  Created by Daniel Braun on 24/02/07.
//  Copyright 2007 Daniel Braun http://page-appart.net, http://braun.daniel.free.fr All rights reserved.
//

#import <Cocoa/Cocoa.h>
#import "WCDom.h"

#import "WCWebLoadProtocol.h"

@class WCUrlAccess;
@class WCWebFetchController;

@interface WCWebExtractSet : NSObject {
	WCUrlAccess *urlaccess;
	NSURL *actualUrl;
	id pageCache;
	NSMutableArray *itemsToExtract; // array of WCWebExtractItem ...
#ifdef DOXYGEN
	WCWebExtractItem *__itemsToExtract;
#endif
	WCWebExtractSet *next; //not saved, set at load/creation
	WCWebExtractSet *prev; //not saved, set at load/creation
	NSString *name;
	NSDictionary *bodyVariables;
}

- (WCUrlAccess *) urlaccess;

// official url, as string
- (NSString *) surl;
- (void) setSurl:(NSString *)s;

// actual url, as URL
- (NSURL *) actualUrl;
- (NSURL *) actualUrlOrContent:(NSString **)pcontent;
- (void) setActualUrl:(NSURL *)url;
- (NSURL *) officialUrl;
- (void) setOfficialUrl:(NSURL *)url;

- (NSNumber *) numItems;
- (int) nItems;

- (NSArray *) itemsToExtract;
- (void) setItemsToExtract:(NSArray *)it;

- (NSDictionary *) processExtractionWithController:(NSObject <WCWebLoadProtocol> *)webCtrl;

- (WCWebExtractSet *) nextExtractSet;
- (void) setNextExtractSet:(WCWebExtractSet *)w;
- (WCWebExtractSet *) prevExtractSet;
- (void) setPrevExtractSet:(WCWebExtractSet *)w;

- (NSString *) name;
- (void) setHtmlTitle:(NSString *)s;
- (void) setName:(NSString *) n;

- (NSString *) jsCode;

- (void) setPageCache:(id) pc dom:(DOMHTMLElement *)dom;
- (void) setPageCache:(id) pc;
- (id) pageCache;

- (void) extractPageVariableFrom:(DOMHTMLElement*)dr;
- (NSDictionary *) bodyVariables;
- (void) setBodyVariables:(NSDictionary *)d;


- (NSArray *) extractVariables;

@end
